//
//  WDJLunPanAddTableCell.m

#import "WDJLunPanAddTableCell.h"

static NSString * LunPanAddTableCellId = @"LunPanAddTableCellId";
@interface WDJLunPanAddTableCell()
@property (nonatomic,strong) UILabel *lunPanEditLab;
@end
@implementation WDJLunPanAddTableCell
+ (instancetype)lunPanAddTableCell:(UITableView *)tableView{
    WDJLunPanAddTableCell * lunPanEditTableCell = [tableView dequeueReusableCellWithIdentifier:LunPanAddTableCellId];
    if (!lunPanEditTableCell) {
        lunPanEditTableCell = [[WDJLunPanAddTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:LunPanAddTableCellId];
    }
    lunPanEditTableCell.backgroundColor = [UIColor clearColor];
    lunPanEditTableCell.selectionStyle = UITableViewCellSelectionStyleNone;
    lunPanEditTableCell.accessoryType = UITableViewCellAccessoryNone;
    return lunPanEditTableCell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self wdjCreatView];
    }
    return self;
}
- (void)wdjCreatView{
    UIView * lunPanEditBgView = [[UIView alloc] init];
    lunPanEditBgView.backgroundColor = [WDjWholeData wholeColorHexString:@"#FFFFFF" withAlph:0.1];
    lunPanEditBgView.layer.cornerRadius = [WDjWholeData wholeScreewRatio:10];
    lunPanEditBgView.clipsToBounds = YES;
    [self.contentView addSubview:lunPanEditBgView];
    [lunPanEditBgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@([WDjWholeData wholeScreewRatio:30]));
        make.right.equalTo(@(-[WDjWholeData wholeScreewRatio:30]));
        make.height.equalTo(@([WDjWholeData wholeScreewRatio:100]));
        make.top.equalTo(@([WDjWholeData wholeScreewRatio:0]));
    }];
    UIImageView * lunPanEditHeadImgView = [[UIImageView alloc] init];
    lunPanEditHeadImgView.image = [WDjWholeData wholeImageNamed:@"wdj_LunPanAdd"];
    [lunPanEditBgView addSubview:lunPanEditHeadImgView];
    [lunPanEditHeadImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@([WDjWholeData wholeScreewRatio:24]));
        make.centerY.equalTo(lunPanEditBgView);
        make.height.equalTo(@([WDjWholeData wholeScreewRatio:42]));
        make.width.equalTo(@([WDjWholeData wholeScreewRatio:42]));
    }];
    
    self.lunPanEditLab = [[UILabel alloc] init];
    self.lunPanEditLab.text = @"添加新选项";
    self.lunPanEditLab.textColor = [WDjWholeData wholeColorHexString:@"#01F2E7"];
    self.lunPanEditLab.font = [UIFont systemFontOfSize:[WDjWholeData wholeScreewRatio:30] weight:UIFontWeightRegular];
    [self addSubview:self.lunPanEditLab];
    [self.lunPanEditLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(lunPanEditHeadImgView.mas_right).offset([WDjWholeData wholeScreewRatio:19]);
        make.centerY.equalTo(lunPanEditHeadImgView);
        make.height.equalTo(@([WDjWholeData wholeScreewRatio:42]));
    }];
    UIButton * lunPanEditBtn = [[UIButton alloc] init];
    [lunPanEditBtn addTarget:self action:@selector(lunPanAdd) forControlEvents:UIControlEventTouchUpInside];
    [lunPanEditBgView addSubview:lunPanEditBtn];
    [lunPanEditBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(@([WDjWholeData wholeScreewRatio:0]));
    }];
}
- (void)lunPanAdd{
    if (self.LunPanAddBlock){
        self.LunPanAddBlock();
    }
}
@end
